﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

using System.Runtime.InteropServices;
using CameraWrapper;


namespace TestUI
{
    public partial class CameraTestCameraWrapper : Form
    {
        SDK10000 camwrap;
        SDK10000.CameraInfo cam1;
        public CameraTestCameraWrapper()
        {
            InitializeComponent();
        }

        private void CameraTest_Load(object sender, EventArgs e)
        {
            cam1 = new SDK10000.CameraInfo(pictureBox1, "194.36.79.201", "D:\\cam1test.avi");
            camwrap = new SDK10000(cam1, null, null);
            if (camwrap.Connect()) label1.Text = "Video server is connected.";
            else label1.Text = ("Can not connect to video server");
             
            camwrap.Play();
        }
        
        private void butRecord_Click(object sender, EventArgs e)
        {
            camwrap.StartRecord();
        }

        private void butStop_Click(object sender, EventArgs e)
        {
            camwrap.StopRecord();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (camwrap.IsPlaying) camwrap.Pause();
            else camwrap.Play();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            camwrap.Play();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            camwrap.Pause();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            camwrap.Stop();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            camwrap.StartRecord(textBox1.Text);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("Need to find what ever part of SavePath of camerainfo in the List & then change that only !", "Implement later");
            cam1.SavePath = textBox2.Text;
            camwrap.StartRecord(cam1); // Record cam1 only
            //Or cam1.StartRecord() will record all the camera include cam1
        }
    }
}
